//
//  TalkfunSDKPlatform.h
//  TalkfunSDKDemo
//
//  Created by 莫瑞权 on 2018/9/28.
//  Copyright © 2018年 Talkfun. All rights reserved.
//

#import <Foundation/Foundation.h>
#import "TalkfunWhiteboard.h"
#import "TalkfunSDKRtcConfig.h"
NS_ASSUME_NONNULL_BEGIN
@protocol TalkfunSDKRtcDelegate <NSObject>
@optional

/*
 讲台开启
 */
- (void)rtcOpen;
/*
 讲台关闭
 */
- (void)rtcClose;
/*
 被邀请连麦
 */
- (void)rtcInvite;
/*
 被取消邀请连麦
 */
- (void)rtcInvitecancel;
/*
 主播拒绝学员的连麦申请
 */
- (void)rtcRejectapply;

/*
 允许连麦
 */
- (void)rtcUp:(TalkfunRtcModel*)model;
/*
  学员主动取消连麦
 */
- (void)rtcDown:(TalkfunRtcModel*)model;
/*
  取消连麦 (主播踢的)
 */
- (void)rtcKick:(TalkfunRtcModel*)model;
/*
 用户离线
 */
- (void)rtcOffline:(TalkfunRtcModel*)model;
/*
 打开摄像头
 */
- (void)rtcOpenVideo:(TalkfunRtcModel*)model;
/*
 关闭摄像头
 */
- (void)rtcCloseVideo:(TalkfunRtcModel*)model;
/*
 打开麦克风
 */
-(void)rtcOpenAudio:(TalkfunRtcModel*)model;
/*
 关闭麦克风
 */
-(void)rtcCloseAudio:(TalkfunRtcModel*)model;
/*
 打开涂鸦权限
 */
-(void)rtcDrawEnable:(TalkfunRtcModel*)model;
/*
 关闭涂鸦权限
 */
-(void)rtcDrawDisable:(TalkfunRtcModel*)model;

/*
 奖励
 */
-(void)rtcAward:(TalkfunRtcModel*)model;

/*
 rtc连接服务器失败
 */
- (void)rtcEngineConnectionDidInterrupted;
//rtc连接服务器重连成功
- (void)rtcDidRejoinChannel;
/*
 小班全体互动事件
 // 全体音频打开
 // 全体音频关闭
 // 全体视频打开
 // 全体视频关闭
 // 全体音视频打开
 // 全体音视频关闭
 */
- (void)onGlobalStatus:(TalkfunGlobalStatus)status;

@end
@interface TalkfunSDKRtc : NSObject

/*代理*/
@property (nonatomic,weak) id<TalkfunSDKRtcDelegate> delegate;

//申请状态
@property (nonatomic,assign)TalkfunApplyStatus  applyStatus;

//讲台状态
@property (nonatomic,assign)TalkfunRTCStatus  RTCStatus;

@property (nonatomic,strong)TalkfunWhiteboard *whiteboard;
@property(nonatomic,assign)BOOL autoUp;//是否自动连麦 (1v6是自动连麦)
@property(nonatomic,assign)BOOL allowApply;//是否允许申请连麦
/*当前学员的model*/
- (TalkfunRtcModel*)getUserModel;

//获取摄像头开关状态
- (BOOL)getVideoStatus;

//获取麦克风开关状态
- (BOOL)getAudioStatus;


//前后摄像头切换
- (void)switchCamera;


//设置美颜
- (void)setBeautyEffectOptions:(BOOL)enable;

/**
 镜像 ,NO为镜像,YES不镜像
 */
-(void)setLocalViewMirror:(BOOL)mirror;
/**
 *   申请连麦
 **/
- (void)apply:(void (^)(NSDictionary* result))callback;
/**
 *   取消连麦申请
 **/
- (void)cancel:(void (^)(NSDictionary* result))callback;
/**
 *    主动取消连麦
 **/
- (void)down:(void (^)(NSDictionary* result))callback;

/**:   打开摄像头, */
- (void)openVideo:(void (^)(NSDictionary* result))callback ;
/**:   关闭摄像头*/
- (void)closeVideo:(void (^)(NSDictionary* result))callback ;

/**   打开麦克风*/
- (void)openAudio:(void (^)(NSDictionary* result))callback ;
/**   关闭麦克风*/
- (void)closeAudio:(void (^)(NSDictionary* result))callback ;

/**
 *   申请连麦2.0
 **/
- (void)applyRTC:(void (^__nullable)(NSInteger code , TFError *_Nullable  error))callback;
/**
 *   取消连麦申请2.0
 **/
- (void)cancelRTC:(void (^__nullable)(NSInteger code , TFError *_Nullable  error))callback;
/**
 *    主动取消连麦2.0
 **/
- (void)downRTC:(void (^__nullable)(NSInteger code , TFError *_Nullable  error))callback;
/**
      响应被邀请上讲台2.0
 */
-(void)respondinviteRTC:(TalkfunRespondinviteStatus)status callback:(void (^__nullable)(NSInteger code , TFError *_Nullable  error))callback;

/**:   打开摄像头开关2.0, */
- (void)setCameraDeviceStatus:(BOOL)status callback:(void (^)(NSInteger code , TFError *error, TalkfunRtcModel* model))callback;
/**   打开麦克风开关2.0*/
- (void)setMicroPhoneDeviceStatus:(BOOL)status callback:(void (^)(NSInteger code , TFError *error, TalkfunRtcModel* model))callback;

/**
 *  静音/取消静音所有用户的声音
 *
 * @param mute YES：静音；NO：取消静音
 *
 * @note 静音时会停止接收所有用户的远端音频流并停止播放，取消静音时会自动拉取所有用户的远端音频流并进行播放。
 */
- (void)muteAllRemoteAudio:(BOOL)mute;

@end
NS_ASSUME_NONNULL_END

